import { HETAxios, urlCombine } from "./HETAxios.js";
import { mAxios, encodeURL } from "./axios.js";
import { useUserStore } from "~/utils/pinia/user.js"
const userStore = useUserStore()
// 获取授权升级页面卫士数量等
export const req_getLicenseInfo = () => HETAxios('GET',"devices/getLicenseInfo")
// 获取授权升级页面机器id与二维码
export const req_getMachineInfo = () => HETAxios('GET',"devices/getMachineInfo")
// 系统工具 Ping 功能
export const req_geToolPing = (ip) => HETAxios('GET',`tool/ping/${ip}`)
// 系统工具 命令行 功能
export const req_geToolTcpdump = (ip) => HETAxios('GET',`tool/tcpdump/${ip}`)
// syslog转发设置表格数据
export const req_getAllSyslogForward = (param) => HETAxios('GET',`syslog/getAllSyslogForward`,param)
// syslog转发设置表格新增
export const req_setAddSyslogForward = (param) => HETAxios('POST',`syslog/addSyslogForward`,param)
// syslog转发设置表格修改
export const req_updateSyslogForward = (param) => HETAxios('POST',`syslog/updateSyslogForward`,param)
// syslog转发设置表格修改
export const req_deleteSyslogForward = (param) => HETAxios('POST',`syslog/deleteSyslogForward`,param)
// 非法外联
export const req_getOutreach = (deviceId,param) => HETAxios('POST',`strategyManager/device/${deviceId}/system/config`,param)

// 非法外联 设置
export const req_setOutreach = (deviceId,param) => {
    return mAxios.put(`strategyManager/device/${deviceId}/system/config`,param,{
        headers:{
            "Content-Type": "application/json;charset=UTF-8",
        }
    },)
}
// 非法外联Linux 状态查询
export const req_getNetDetectionRules = (deviceId,param) => HETAxios('GET',`strategyManager/outer/${deviceId}/getNetDetectionRules`,param)
// 非法外联Linux 新增
export const req_addNetDetectionRules = (deviceId,param) => HETAxios('POST',`strategyManager/outer/${deviceId}/addNetDetectionRules`,param)
// 非法外联Linux 修改
export const req_updateNetDetectionRules = (deviceId,param) => HETAxios('POST',`strategyManager/outer/${deviceId}/updateNetDetectionRules`,param)
// 非法外联Linux 删除
export const req_deleteNetDetectionRules = (deviceId,param) => HETAxios('POST',`strategyManager/outer/${deviceId}/deleteNetDetectionRules`,param)
// 日志管理-审计日志
// 日志查询
export const req_getAuditLog = (deviceId,param) => HETAxios('GET',`logManager/${deviceId}/event`,param)

// 日志管理-审计日志-分组下所有日志
export const req_getGuardLogs = (param) => HETAxios('GET',`logManager/getGuardLogs`,param)
export const req_getGuardLogsCount = (param) => HETAxios('GET',`logManager/getGuardLogsCount`,param)

// license 导入
export const req_uploadLicenseFile = (params) => HETAxios('POST',`files/device/uploadLicenseFile`,params,{
    headers: {
        'Content-Type': 'multipart/form-data'
    }
})
// 系统设置-基本设置-网络端口配置
export const req_getNetworkInterface = () => HETAxios('GET',`systemsetting/networkInterface`)
// 系统设置-基本设置-安全配置
export const req_getStrategybuilders = () => HETAxios('GET',`strategymanagement/strategybuilders`)
// 系统设置-基本设置
export const req_getSystemSetting = () => HETAxios('GET',`systemsetting`)
// 系统设置-安全配置
export const req_setMaxLogin = (url,param) => HETAxios('PUT',`strategymanagement/${url}/ruledata`,param)
// 系统设置-网络端口配置
export const req_setPort = (network,param) => HETAxios('PUT',`systemsetting/networkInterface/slotNum/mainboard/port/${network}`,param)
// 系统设置-时钟同步-ntp
export const req_setNtp = (param) => HETAxios('POST',`systemsetting/topology/${userStore.domains.domainInfo.currentTopologyId}/ntp`,param)
// 系统设置-时钟同步-同步时间
export const req_setSystemTime = (param) => HETAxios('POST',`systemsetting/topology/${userStore.domains.domainInfo.currentTopologyId}/systemtime`,param)
export const req_setSystemTimeCopy = (param) => HETAxios('POST',`guardtool/topology/systemtime`,param)
// 默认用户初始设置及查询
// export const req_getDefaultDomains = () => HETAxios('GET','domains/?$filter=(contains(domainName,%20%27%27)%20or%20contains(domainCode,%20%27%27))')
export const req_getDefaultDomains = (deviceId,param) => {
    return mAxios.get(`domains/?$filter=(contains(domainName,%20%27%27)%20or%20contains(domainCode,%20%27%27))`)
}
// 默认用户设置
export const req_setUserLock = (param) => HETAxios('PUT',`users/user/${param}/${userStore.domains.user.userId}`)
// 默认用户设置密码
export const req_setInitdomain = (param) => HETAxios('POST',`domains/initdomain/`,param)

// 安全事件
export const req_getStatistics = (param) => HETAxios('GET',`logManager/statistics/group/starttime/${param.startTime}/endtime/${param.endTime}`)
// 安全事件趋势图
export const req_getTrend = (param) => HETAxios('GET',`logManager/statistics/frequency/${param.frequency}/starttime/${param.startTime}/endtime/${param.endTime}`,param.clienttime)

